package com.sphd.restaurantsystem.presenter;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.JiFenGiveInfo;
import com.sphd.restaurantsystem.model.ConsumeJifenModelImpl;
import com.sphd.restaurantsystem.view.ConsumeJifenView;

import java.util.List;

/**
* Created by Hu on 2016/12/22
*/

public class ConsumeJifenPresenterImpl implements ConsumeJifenPresenter{
    ConsumeJifenModelImpl consumeJifenModel;
    ConsumeJifenView consumeJifenView;

    public ConsumeJifenPresenterImpl(ConsumeJifenView consumeJifenView) {
        this.consumeJifenView = consumeJifenView;
        consumeJifenModel=new ConsumeJifenModelImpl();
    }

    @Override
    public void addData(String url) {
        consumeJifenView.showLoading();
        consumeJifenModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        consumeJifenView.dissLoading();
    }

    @Override
    public void recList(List<JiFenGiveInfo> jiFenGiveInfoList) {
        consumeJifenView.recList(jiFenGiveInfoList);
        consumeJifenView.dissLoading();
    }

    @Override
    public void setUirl(String url) {
        consumeJifenView.showLoading();
        consumeJifenModel.setUrl(url,this);
    }

    @Override
    public void sendRes(int res) {
        consumeJifenView.recRes(res);
        consumeJifenView.dissLoading();
    }
}